package com.kim.net.utils;

import com.kim.net.NetEntity;
import com.kim.net.impl.NetCallbackImplBase;
import com.kim.net.impl.NetCallbackImplBase.Notify;
import com.kim.net.impl.NetProcessProxy;
import com.kim.net.impl.NetProcessProxy.NetRequestType;

public abstract class BusinessBase implements BusinessInterface {

	NetEntity netEntity;
	Notify notify;
	String url;

	public BusinessBase(Notify notify) {
		this.notify = notify;
	}

	public BusinessBase(Notify notify, String url) {
		super();
		this.notify = notify;
		this.url = url;
	}

	public NetEntity getNetEntity() {
		return netEntity;
	}

	public void setNetEntity(NetEntity netEntity) {
		this.netEntity = netEntity;
	}

	@Override
	public abstract void prepare();

	@Override
	public void doBusiness() {
		NetProcessProxy.proxy(netEntity, new NetCallbackImplBase(notify),
				NetRequestType.POST);
	}

	@Override
	public void doBusinessInGet() {
		NetProcessProxy.doGet(url, new NetCallbackImplBase(notify));
	}

	@Override
	public void doBusinessInGetWithParam() {
		NetProcessProxy.doGet(netEntity, new NetCallbackImplBase(notify));
	}

}
